if not HST then return end

HST.SlotNames = {
	["Head"] = "HeadSlot",
	["Neck"] = "NeckSlot",
	["Shoulder"] = "ShoulderSlot",
	["Back"] = "BackSlot",
	["Chest"] = "ChestSlot",
	["Shirt"] = "ShirtSlot",
	["Tabard"] = "TabardSlot",
	["Wrist"] = "WristSlot",

	["Hands"] = "HandsSlot",
	["waist"] = "waistSlot",
	["Legs"] = "LegsSlot",
	["Feet"] = "FeetSlot",
	["Finger0"] = "Finger0Slot",
	["Finger1"] = "Finger1Slot",
	["Trinket0"] = "Trinket0Slot",
	["Trinket1"] = "Trinket1Slot",

	["MainHand"] = "MainHandSlot",
	["OffHand"] = "OffHandSlot",
	["Ranged"] = "RangedSlot",
}

HST.WeaponSpeedDescriptionFormat = "速度 (.*)"

function HST:GetCurrentRangedWeaponSpeed()
	HST.ScanTip:ClearLines()
	HST.ScanTip:SetInventoryItem("player", GetInventorySlotInfo(HST.SlotNames["Ranged"]))

	for i = 4, 5 do
		local text = getglobal("HSTScanTipTextRight" .. i):GetText()
		for source in gfind(text, HST.WeaponSpeedDescriptionFormat) do
			return tonumber(source)
		end
	end

	return 0.0
end

function HST:GetRangedHaste()
	local actual = UnitRangedDamage("player")
	if actual <= 0 then return 0 end

	local haste = self:GetCurrentRangedWeaponSpeed() / actual
	return self:Regulate(haste, 0.001) - 1
end